
from django.urls import path, re_path

from users.views import Regist, UsernameCountView, MoblieCountView, LoginView, LogoutView, UserInfoView, \
    UserOrderInfoView, AddressView, AddressCreateView, DefaultAddressView

app_name="users"


urlpatterns=[
    #名称空间 ：名称（在引用的时候
    path('register/',Regist.as_view(),name="register"),
    re_path('usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/',UsernameCountView.as_view()),
    re_path(r'mobiles/(?P<mobile>1[3-9]\d{9})/count/',MoblieCountView.as_view()),
    path('login/',LoginView.as_view(),name="login"),
    # 用户退出
    path('logout/', LogoutView.as_view(), name='logout'),
    path('info/', UserInfoView.as_view(), name='info'),
    path('orders/info/<int:page_num>/', UserOrderInfoView.as_view(),name='myorderinfo'),
    # 展示地址
    path('addresses/', AddressView.as_view(), name='address'),
    # 新增用户地址
    path('addresses/create/', AddressCreateView.as_view()),
    # 设置默认地址
    path('addresses/<int:address_id>/default/', DefaultAddressView.as_view()),
]